package com.clanmy.ui.controller;

import com.clanmy.ui.service.AnchorPaneService;
import com.fx.spring.annotation.ControllerFX;
import com.fx.spring.controller.AbstractController;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;

import java.net.URL;
import java.util.ResourceBundle;

@ControllerFX(fxmlURL = "/ui/anchorPaneDemo.fxml")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AnchorPaneController extends AbstractController<StackPane> {

    public Button testButton;
    public Label testLabel;

    @Autowired
    private AnchorPaneService anchorPaneService;

    public Button getTestButton() {
        return testButton;
    }


    @Override
    public void initialize(URL location, ResourceBundle resources) {
        System.out.println(location.getPath() + "加载成功");
        anchorPaneService.serviceTest();
    }


    public void setTestLabelMessage(String message){
        testLabel.setText(message);
    }


    public void testOnAction(ActionEvent actionEvent) {
        System.out.println(this);
    }


}
